package com.sluggard.security.manage.controller;

import com.sluggard.common.model.res.Result;
import com.sluggard.mp.mvc.BaseController;
import com.sluggard.security.manage.model.entity.OlogEntity;
import com.sluggard.security.manage.model.req.OlogReq;
import com.sluggard.security.manage.service.IOlogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 操作日志 前端控制器
 * </p>
 *
 * @author lizheng
 * @since 2024-04-28
 */
@Tag(name = "操作日志")
@RestController
@RequestMapping("/manage/system/olog")
public class OlogController extends BaseController<OlogReq, OlogEntity, IOlogService> {

    @Resource
    private IOlogService ologService;

    @Operation(summary = "手动归档")
    @PostMapping("archive")
    public Result<Void> archive() {
        try {
            ologService.archive();
            return Result.ok("手动归档成功");
        } catch (Exception e) {
            return Result.error("手动归档：" + e.getMessage());
        }
    }

}
